<?php

session_start();

include_once('config.php');

$id = $_POST['id'];
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$userName = $_POST['userName'];
$password = $_POST['password'];
$userStatus = $_POST['userStatus'];

$sql = "UPDATE `user` SET userName='$userName', firstName='$firstName', lastName='$lastName', password=$password,
        active=$userStatus WHERE id=$id";
$result = mysql_query($sql);

//echo '
//                    <tr style="background-color: #0080C0; color: white; text-align: left; font-weight: 600;">
//                        <td>First Name</td>
//                        <td>Last Name</td>
//                        <td>User Name</td>
//                        <td>Password</td>
//                        <td>Active</td>
//                        <td></td>
//                    </tr>';

//    $sql = "SELECT * FROM `user`";
//    $result = mysql_query($sql);
//    while ($row = mysql_fetch_array($result)) {
//
//        echo '<tr>
//                        <td><input type="text" value="' . $row['firstName'] . '"/></td>
//                        <td><input type="text" value="' . $row['lastName'] . '"/></td>
//                        <td><input type="text" value="' . $row['userName'] . '"/></td>
//                        <td><input type="text" value="' . $row['password'] . '"/></td>
//                        <td>
//                            <select >
//                                <option value="1">Active</option>
//                                <option value="0">Not Active</option>
//                            </select>
//                        </td>
//                            <td>';
//        if ($_SESSION['id'] == $row['id']) {
//            echo '
//                    <a href="javascript:void(0);" firstName="' . $row['firstName'] . '" lastName="' . $row['lastName'] . '" userName="' . $row['userName'] . '" password="' . $row['password'] . '" userStatus="1" title="updateUser" calss="updateUser" content="' . $row['id'] . '"><img src="images/update.png" firstName="' . $row['firstName'] . '" lastName="' . $row['lastName'] . '" userName="' . $row['userName'] . '" password="' . $row['password'] . '" userStatus="1"  class="updateUser" content="' . $row['id'] . '" width="20px;" style="float:right; margin-right:10px;"/></a>
//                </td>
//                </tr>';
//        }else{
//            echo '<a href="javascript:void(0);" title="deleteUser" class="deleteUser" content="' . $row['id'] . '"><img src="images/delete.png" width="20px;" content="' . $row['id'] . '" style="float:right; margin-right:20px;"/></a>
//                    <a href="javascript:void(0);" firstName="' . $row['firstName'] . '" lastName="' . $row['lastName'] . '" userName="' . $row['userName'] . '" password="' . $row['password'] . '" userStatus="1" title="updateUser" calss="updateUser" content="' . $row['id'] . '"><img src="images/update.png" firstName="' . $row['firstName'] . '" lastName="' . $row['lastName'] . '" userName="' . $row['userName'] . '" password="' . $row['password'] . '" userStatus="1"  class="updateUser" content="' . $row['id'] . '" width="20px;" style="float:right; margin-right:10px;"/></a>
//                </td>
//                </tr>';
//        }
//    }

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
?>
